home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / NEWSV.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-22  |  21.5 KB  |  688 lines

  1. VERSION 2.00
  2. Begin Form NewsForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Mabry News"
  5.    ClientHeight    =   7740
  6.    ClientLeft      =   1035
  7.    ClientTop       =   1770
  8.    ClientWidth     =   10350
  9.    Height          =   8430
  10.    Left            =   975
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   7740
  13.    ScaleWidth      =   10350
  14.    Top             =   1140
  15.    Width           =   10470
  16.    Begin MabryNews News1 
  17.       Blocking        =   0   'False
  18.       Debug           =   1  'Enabled
  19.       Host            =   ""
  20.       Left            =   9480
  21.       PostingHost     =   ""
  22.       Timeout         =   0
  23.       Top             =   240
  24.    End
  25.    Begin CommandButton cmdHSplit 
  26.       FontBold        =   -1  'True
  27.       FontItalic      =   0   'False
  28.       FontName        =   "Courier New"
  29.       FontSize        =   0.75
  30.       FontStrikethru  =   0   'False
  31.       FontUnderline   =   0   'False
  32.       Height          =   90
  33.       Left            =   105
  34.       TabIndex        =   14
  35.       Top             =   3645
  36.       Width           =   9750
  37.    End
  38.    Begin CommandButton cmdVSplit 
  39.       Height          =   3090
  40.       Left            =   4905
  41.       TabIndex        =   13
  42.       Top             =   690
  43.       Width           =   90
  44.    End
  45.    Begin TextBox Text1 
  46.       FontBold        =   0   'False
  47.       FontItalic      =   0   'False
  48.       FontName        =   "Courier New"
  49.       FontSize        =   8.25
  50.       FontStrikethru  =   0   'False
  51.       FontUnderline   =   0   'False
  52.       Height          =   3015
  53.       Left            =   195
  54.       MultiLine       =   -1  'True
  55.       ScrollBars      =   3  'Both
  56.       TabIndex        =   12
  57.       Top             =   4365
  58.       Width           =   9885
  59.    End
  60.    Begin ListBox listArticles 
  61.       Height          =   2955
  62.       Left            =   5730
  63.       TabIndex        =   11
  64.       Top             =   885
  65.       Width           =   4275
  66.    End
  67.    Begin ListBox listGroups 
  68.       Height          =   3150
  69.       Left            =   75
  70.       TabIndex        =   10
  71.       Top             =   960
  72.       Width           =   4515
  73.    End
  74.    Begin CheckBox Flag 
  75.       Caption         =   "Flag"
  76.       Height          =   285
  77.       Left            =   8610
  78.       TabIndex        =   9
  79.       Top             =   255
  80.       Visible         =   0   'False
  81.       Width           =   690
  82.    End
  83.    Begin CheckBox Check2 
  84.       BackColor       =   &H00C0C0C0&
  85.       Caption         =   "Trace"
  86.       FontBold        =   0   'False
  87.       FontItalic      =   0   'False
  88.       FontName        =   "MS Sans Serif"
  89.       FontSize        =   8.25
  90.       FontStrikethru  =   0   'False
  91.       FontUnderline   =   0   'False
  92.       Height          =   240
  93.       Left            =   7290
  94.       TabIndex        =   8
  95.       Top             =   345
  96.       Width           =   1110
  97.    End
  98.    Begin CheckBox Check1 
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "Blocking"
  101.       FontBold        =   0   'False
  102.       FontItalic      =   0   'False
  103.       FontName        =   "MS Sans Serif"
  104.       FontSize        =   8.25
  105.       FontStrikethru  =   0   'False
  106.       FontUnderline   =   0   'False
  107.       Height          =   240
  108.       Left            =   7290
  109.       TabIndex        =   7
  110.       Top             =   120
  111.       Width           =   1065
  112.    End
  113.    Begin CommandButton cmdCancelMsg 
  114.       Caption         =   "Cancel Msg"
  115.       FontBold        =   0   'False
  116.       FontItalic      =   0   'False
  117.       FontName        =   "MS Sans Serif"
  118.       FontSize        =   8.25
  119.       FontStrikethru  =   0   'False
  120.       FontUnderline   =   0   'False
  121.       Height          =   375
  122.       Left            =   6180
  123.       TabIndex        =   6
  124.       Top             =   120
  125.       Width           =   1020
  126.    End
  127.    Begin CommandButton cmdReply 
  128.       Caption         =   "Reply"
  129.       FontBold        =   0   'False
  130.       FontItalic      =   0   'False
  131.       FontName        =   "MS Sans Serif"
  132.       FontSize        =   8.25
  133.       FontStrikethru  =   0   'False
  134.       FontUnderline   =   0   'False
  135.       Height          =   375
  136.       Left            =   5160
  137.       TabIndex        =   5
  138.       Top             =   120
  139.       Width           =   1020
  140.    End
  141.    Begin CommandButton cmdNewArticle 
  142.       Caption         =   "New Article"
  143.       FontBold        =   0   'False
  144.       FontItalic      =   0   'False
  145.       FontName        =   "MS Sans Serif"
  146.       FontSize        =   8.25
  147.       FontStrikethru  =   0   'False
  148.       FontUnderline   =   0   'False
  149.       Height          =   375
  150.       Left            =   4140
  151.       TabIndex        =   4
  152.       Top             =   120
  153.       Width           =   1020
  154.    End
  155.    Begin CommandButton cmdGetAllGroups 
  156.       Caption         =   "All Groups"
  157.       FontBold        =   0   'False
  158.       FontItalic      =   0   'False
  159.       FontName        =   "MS Sans Serif"
  160.       FontSize        =   8.25
  161.       FontStrikethru  =   0   'False
  162.       FontUnderline   =   0   'False
  163.       Height          =   375
  164.       Left            =   3120
  165.       TabIndex        =   3
  166.       Top             =   120
  167.       Width           =   1020
  168.    End
  169.    Begin CommandButton cmdGetNewGroups 
  170.       Caption         =   "New Groups"
  171.       FontBold        =   0   'False
  172.       FontItalic      =   0   'False
  173.       FontName        =   "MS Sans Serif"
  174.       FontSize        =   8.25
  175.       FontStrikethru  =   0   'False
  176.       FontUnderline   =   0   'False
  177.       Height          =   375
  178.       Left            =   2100
  179.       TabIndex        =   2
  180.       Top             =   120
  181.       Width           =   1020
  182.    End
  183.    Begin CommandButton cmdDisconnect 
  184.       Caption         =   "Disconnect"
  185.       FontBold        =   0   'False
  186.       FontItalic      =   0   'False
  187.       FontName        =   "MS Sans Serif"
  188.       FontSize        =   8.25
  189.       FontStrikethru  =   0   'False
  190.       FontUnderline   =   0   'False
  191.       Height          =   375
  192.       Left            =   1080
  193.       TabIndex        =   1
  194.       Top             =   120
  195.       Width           =   1020
  196.    End
  197.    Begin CommandButton cmdConnect 
  198.       Caption         =   "Connect"
  199.       FontBold        =   0   'False
  200.       FontItalic      =   0   'False
  201.       FontName        =   "MS Sans Serif"
  202.       FontSize        =   8.25
  203.       FontStrikethru  =   0   'False
  204.       FontUnderline   =   0   'False
  205.       Height          =   375
  206.       Left            =   60
  207.       TabIndex        =   0
  208.       Top             =   120
  209.       Width           =   1020
  210.    End
  211.    Begin Line Line2 
  212.       BorderColor     =   &H00808080&
  213.       X1              =   -75
  214.       X2              =   7245
  215.       Y1              =   690
  216.       Y2              =   690
  217.    End
  218.    Begin Line Line1 
  219.       BorderColor     =   &H00FFFFFF&
  220.       X1              =   60
  221.       X2              =   7275
  222.       Y1              =   15
  223.       Y2              =   15
  224.    End
  225.    Begin Menu FileMenu 
  226.       Caption         =   "&File"
  227.       Begin Menu FileExit 
  228.          Caption         =   "E&xit"
  229.       End
  230.    End
  231.    Begin Menu SettingsMenu 
  232.       Caption         =   "&Settings"
  233.       Begin Menu SettingsUser 
  234.          Caption         =   "&User..."
  235.       End
  236.       Begin Menu SettingsConnection 
  237.          Caption         =   "&Connection..."
  238.       End
  239.    End
  240.    Begin Menu ShowMenu 
  241.       Caption         =   "Sh&ow"
  242.       Begin Menu ShowHeaders 
  243.          Caption         =   "&Headers"
  244.       End
  245.    End
  246. ' Sample program for Mabry News Control
  247. ' This sample shows both blocking and non-blocking use of
  248. ' the Mabry News control.  Please note that this sample does
  249. ' not trap errors returned by the control (connection failure,
  250. ' for instance).  If an error is returned you'll see the usual VB
  251. ' error message box.
  252. ' Zane Thomas/May 96
  253. Option Explicit
  254. ' state is used in non-blocking mode to determine what to do
  255. ' when the Done and DataReady events are fired
  256. Dim State As Integer
  257. Const StateDisconnected = 0
  258. Const StateGetGroups = 1
  259. Const StateSelectGroup = 2
  260. Const StateGetArticleIDs = 3
  261. Const StateGetArticle = 4
  262. Const StateGetHeader = 5
  263. Const StateXOver = 6
  264. Const StateConnecting = 7
  265. Const StateConnected = 8
  266. Const StateDisconnecting = 9
  267. ' For spacing during Form_Resize
  268. Const Margin = 2
  269. ' Used during article and group retrieval, see AddArticleIDsToList
  270. ' and Add GroupsToList for details
  271. Dim articleIndex As Integer
  272. Dim groupIndex As Integer
  273. Dim vbCrlf As String
  274. Sub AddGroupsToList (i As Integer)
  275.     Dim Group As String
  276.     Do While (i < News1.GroupCount)
  277.         Group = News1.Groups(i)
  278.         Group = Left$(Group, InStr(Group, " ") - 1)
  279.         listGroups.AddItem Group
  280.         i = i + 1
  281.     Loop
  282. End Sub
  283. Sub cmdCancelMsg_Click ()
  284.     Dim i As Integer
  285.     Dim j As Integer
  286.     i = InStr(g_emailaddr, "@")
  287.     j = InStr(g_emailaddr, "(") - 1
  288.     News1.EMailAddress = g_emailaddr
  289.     News1.PostingHost = Mid(g_emailaddr, i + 1, j - i - 1)
  290.     News1.HeadersCount = 0
  291.     News1.Subject = "cmsg cancel " & News1.ArticleID
  292.     News1.NewsGroups = News1.NewsGroups & ",control.cancel"
  293.     News1.Headers(0) = "Control: cancel " & News1.ArticleID
  294.     News1.ArticleID = Format(Now, "ddmmyyhhmmss") & "@" & News1.PostingHost
  295.     News1.Date = Format(Now, "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  296.     News1.References = ""
  297.     News1.BodyText = ""
  298.     News1.Action = NewsPostArticle
  299. End Sub
  300. Sub cmdConnect_Click ()
  301.     News1.LogonName = g_logonname
  302.     News1.LogonPassword = g_logonpass
  303.     listGroups.Clear
  304.     listArticles.Clear
  305.     Text1.Text = ""
  306.     If (Check1.Value = 1) Then
  307.         News1.Blocking = True
  308.     Else
  309.         News1.Blocking = False
  310.     End If
  311.     EnableControls False
  312.     State = StateConnecting
  313.     News1.Action = NewsConnect
  314.     If (News1.Blocking) Then
  315.         News1_Done 0
  316.     End If
  317. End Sub
  318. Sub cmdDisconnect_Click ()
  319.     EnableControls False
  320.     State = StateDisconnecting
  321.     News1.Action = NewsDisconnect
  322.     listGroups.Clear
  323.     listArticles.Clear
  324.     Text1.Text = ""
  325.     If (News1.Blocking) Then
  326.         News1_Done 0
  327.     End If
  328. End Sub
  329. Sub cmdGetAllGroups_Click ()
  330.     Dim i As Integer
  331.     State = StateGetGroups
  332.     EnableControls False
  333.     listGroups.Clear
  334.     groupIndex = 0
  335.     News1.Action = NewsGetAllGroups
  336.     If (News1.Blocking) Then
  337.         News1_Done 0
  338.     End If
  339. End Sub
  340. Sub cmdGetNewGroups_Click ()
  341.     State = StateGetGroups
  342.     '
  343.     ' A real newsreader would keep track of the last
  344.     ' time the news groups were updated and supply an
  345.     ' appropriate date here
  346.     '
  347.     News1.Date = Format("04/30/1996 00:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  348.     EnableControls False
  349.     listGroups.Clear
  350.     groupIndex = 0
  351.     News1.Action = NewsGetNewGroups
  352.     If (News1.Blocking) Then
  353.         News1_Done 0
  354.     End If
  355. End Sub
  356. Sub cmdNewArticle_Click ()
  357.     PostArticle False
  358. End Sub
  359. Sub cmdReply_Click ()
  360.     PostArticle True
  361. End Sub
  362. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  363. ' Misc Subs
  364. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  365. Private Sub EnableControls (fEnable As Integer)
  366.     If (fEnable = False) Then
  367.         cmdConnect.Enabled = fEnable
  368.         cmdDisconnect.Enabled = fEnable
  369.         cmdGetAllGroups.Enabled = fEnable
  370.         cmdGetNewGroups.Enabled = fEnable
  371.         cmdNewArticle.Enabled = fEnable
  372.         cmdReply.Enabled = fEnable
  373.         cmdCancelMsg.Enabled = fEnable
  374.         listGroups.Enabled = fEnable
  375.         listArticles.Enabled = fEnable
  376.     ElseIf (State = StateConnected) Then
  377.         cmdConnect.Enabled = False
  378.         cmdDisconnect.Enabled = True
  379.         cmdGetAllGroups.Enabled = True
  380.         cmdGetNewGroups.Enabled = True
  381.         cmdNewArticle.Enabled = True
  382.         cmdReply.Enabled = True
  383.         cmdCancelMsg.Enabled = True
  384.         If (listGroups.ListCount > 0) Then
  385.             listGroups.Enabled = True
  386.         Else
  387.             listGroups.Enabled = False
  388.         End If
  389.         If (listArticles.ListCount > 0) Then
  390.             listArticles.Enabled = True
  391.         Else
  392.             listArticles.Enabled = False
  393.         End If
  394.     Else
  395.         cmdConnect.Enabled = True
  396.         cmdDisconnect.Enabled = False
  397.         cmdGetAllGroups.Enabled = False
  398.         cmdGetNewGroups.Enabled = False
  399.         cmdNewArticle.Enabled = False
  400.         cmdReply.Enabled = False
  401.         cmdCancelMsg.Enabled = False
  402.         listGroups.Enabled = False
  403.         listArticles.Enabled = False
  404.     End If
  405. End Sub
  406. Sub Form_Load ()
  407.     State = StateDisconnected
  408.     News1.Host = "msnews.microsoft.com"
  409.     News1.LogonName = ""
  410.     News1.LogonPassword = ""
  411.     News1.Debug = 1
  412.     vbCrlf = Chr$(13) & Chr$(10)
  413.     EnableControls True
  414.     Me.Show
  415.     SetPopupPos UserInfo
  416.     UserInfo.Show 1
  417. End Sub
  418. Sub Form_Resize ()
  419.     line1.X1 = 0
  420.     Line2.X1 = 0
  421.     line1.X2 = Me.ScaleWidth
  422.     Line2.X2 = Me.ScaleWidth
  423.     cmdVSplit.Height = cmdHSplit.Top - Line2.Y2 - 1
  424.     cmdHSplit.Left = 0
  425.     cmdHSplit.Width = Me.ScaleWidth
  426.     listGroups.Top = Line2.Y1 + Margin
  427.     listGroups.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  428.     listGroups.Left = Margin
  429.     listGroups.Width = cmdVSplit.Left - Margin * 2
  430.     listArticles.Top = Line2.Y1 + Margin
  431.     listArticles.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  432.     listArticles.Left = cmdVSplit.Left + cmdVSplit.Width + Margin
  433.     listArticles.Width = Me.ScaleWidth - listArticles.Left - Margin
  434.     Text1.Top = cmdHSplit.Top + cmdHSplit.Height + Margin
  435.     Text1.Height = Me.ScaleHeight - (cmdHSplit.Top + cmdHSplit.Height) - Margin * 2
  436.     Text1.Left = Margin
  437.     Text1.Width = Me.ScaleWidth - Margin * 2
  438. End Sub
  439. Private Sub listArticles_DblClick ()
  440. ' Use this code for non-xover servers
  441. '    News1.ArticleID = News1.ArticleIDs(listArticles.ListIndex)
  442. ' cut here for non-xover servers
  443.     News1.ArticleID = listArticles.ItemData(listArticles.ListIndex)
  444. ' end cut
  445.     State = StateGetArticle
  446.     EnableControls False
  447.     News1.Action = NewsGetArticle
  448.     If (News1.Blocking) Then
  449.         News1_Done 0
  450.     End If
  451. End Sub
  452. Private Sub listGroups_DblClick ()
  453.     News1.Group = listGroups.List(listGroups.ListIndex)
  454.     News1.NewsGroups = News1.Group
  455.     State = StateSelectGroup
  456.     EnableControls False
  457.     News1.Action = NewsSelectGroup
  458.     listArticles.Clear
  459.     If (News1.Blocking) Then
  460.         News1_Done 0
  461.     End If
  462. End Sub
  463. Sub ListHeaders ()
  464. '''''''''''''''''
  465. ' cut here for non-xover servers
  466.     Dim i As Integer
  467.     Dim s As String
  468.     Dim n As Long
  469.     For i = 0 To News1.XOverHeadersCount - 1
  470.         s = News1.XOverHeaders(i)
  471.         n = Val(Left(s, InStr(s, Chr(9)) - 1))
  472.         s = Right(s, Len(s) - InStr(s, Chr(9)))
  473.         s = Left(s, InStr(s, Chr(9)))
  474.         listArticles.AddItem s
  475.         listArticles.ItemData(i) = n
  476.     Next
  477. ' end cut
  478. '''''''''''''''''
  479. ' Use this code for non-xover servers
  480. ' Note: Getting individual headers is a whole lot slower than using
  481. ' xover.
  482. '    If (News1.Blocking) Then
  483. '        Do While articleIndex < News1.ArticleIDsCount
  484. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  485. '            News1.GetHeader
  486. '            listArticles.AddItem News1.Subject
  487. '            articleIndex = articleIndex + 1
  488. '            DoEvents
  489. '        Loop
  490. '    Else
  491. '        If (articleIndex < News1.ArticleIDsCount) Then
  492. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  493. '            articleIndex = articleIndex + 1
  494. '            state = StateGetHeader
  495. '            News1.GetHeader
  496. '        Else
  497. '            EnableControls True
  498. '            state = StateNone
  499. '        End If
  500. '    End If
  501. End Sub
  502. Sub News1_AsyncError (ErrorCode As Integer, ErrorMsg As String)
  503.     MsgBox "AsyncError: " & ErrorMsg & "(" & Str(ErrorCode) & ")"
  504.     Select Case State
  505.         Case StateGetGroups, StateSelectGroup, StateGetArticleIDs, StateGetArticle, StateGetHeader, StateXOver
  506.             State = StateConnected
  507.             EnableControls True
  508.         Case Else
  509.             State = StateDisconnected
  510.             EnableControls False
  511.     End Select
  512.     EnableControls True
  513. End Sub
  514. Sub News1_DataReady ()
  515.     Select Case State
  516.         Case StateGetGroups
  517.             AddGroupsToList groupIndex
  518.     End Select
  519. End Sub
  520. Sub News1_Debug (Message As String)
  521.     If (Check2.Value <> 0) Then
  522.         Debug.Print Message
  523.     End If
  524. End Sub
  525. Sub News1_Done (ErrorCode As Integer)
  526.     Dim i As Integer
  527.     Select Case State
  528.         Case StateConnecting
  529.             If (ErrorCode = 0) Then
  530.                 State = StateConnected
  531.             End If
  532.             EnableControls True
  533.         Case StateDisconnecting
  534.             State = StateDisconnected
  535.             EnableControls True
  536.         Case StateGetArticleIDs
  537.             State = StateConnected
  538.             articleIndex = 0
  539.             ListHeaders
  540.         Case StateGetGroups
  541.             AddGroupsToList groupIndex
  542.             State = StateConnected
  543.             EnableControls True
  544.         Case StateSelectGroup
  545.             '
  546.             ' Just finished selecting a group, get the article ids
  547.             '
  548. ' Use this code if the xover command isn't
  549. ' supported for the connected server
  550. '            state = StateGetArticleIDs
  551. '            listArticles.Clear
  552. '            News1.Date = Format("05/22/1996 12:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  553. '            articleIndex = 0
  554. '            News1.GetNewNews
  555.             Flag.Value = 0
  556.             
  557.             msgrange.First.Text = News1.FirstArticle
  558.             msgrange.Last.Text = News1.LastArticle
  559.             msgrange.Show 1
  560.             If (Flag.Value = 0) Then
  561.                 State = StateConnected
  562.                 EnableControls True
  563.                 Exit Sub
  564.             End If
  565. ''''''''''''''''''''''
  566. ' cut this code for non-xover servers
  567.             State = StateXOver
  568.             News1.Action = NewsXover
  569. ' end cut
  570. ''''''''''''''''''''''
  571.             If (News1.Blocking) Then
  572.                 ListHeaders
  573.                 State = StateConnected
  574.                 EnableControls True
  575.             End If
  576.         Case StateGetArticle
  577.             State = StateConnected
  578.             EnableControls True
  579.             If (ShowHeaders.Checked) Then
  580.                 Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  581.             Else
  582.                 Text1.Text = News1.BodyText
  583.             End If
  584.         Case StateGetHeader
  585.             listArticles.AddItem News1.Subject
  586.             ListHeaders
  587.         Case StateXOver
  588.             ListHeaders
  589.             State = StateConnected
  590.             EnableControls True
  591.         Case Else
  592.             State = StateConnected
  593.             EnableControls True
  594.     End Select
  595. End Sub
  596. Sub PostArticle (reply As Integer)
  597.     Dim i As Integer
  598.     Dim j As Integer
  599.     Dim s As String
  600.     Dim Body As String
  601.     '
  602.     ' Set user info from e-mail address
  603.     '
  604.     i = InStr(g_emailaddr, "@")
  605.     j = InStr(g_emailaddr, "(") - 1
  606.     News1.EMailAddress = g_emailaddr
  607.     News1.PostingHost = Mid(g_emailaddr, i + 1, j - i - 1)
  608.     '
  609.     ' Add optional headers
  610.     '
  611.     News1.HeadersCount = 0
  612.     News1.Headers(0) = "Organization: Mabry Software http://www.mabry.com"
  613.     News1.Headers(1) = "X-Newsreader: Mabry News"
  614.     News1.Headers(2) = "X-Test: foo"
  615.     '
  616.     ' If this is a reply message
  617.     '
  618.     If (reply) Then
  619.         '
  620.         ' Set references line
  621.         '
  622.         s = News1.References & " " & News1.ArticleID
  623.         Do While (Len(s) > 512)
  624.             i = InStr(s, "> <")
  625.             If (i = 0) Then
  626.                 ' This should never happen ... but
  627.                 Exit Do
  628.             End If
  629.             s = Right(s, Len(s) - (i + 1))
  630.         Loop
  631.         News1.References = s
  632.         '
  633.         ' Set groups and subject
  634.         '
  635.         NewMessage.NewsGroups.Text = News1.NewsGroups
  636.         If (LCase$(Left(News1.Subject, 3)) <> "re:") Then
  637.             NewMessage.Subject.Text = "Re: " & News1.Subject
  638.         Else
  639.             NewMessage.Subject.Text = News1.Subject
  640.         End If
  641.         '
  642.         ' Quote body text in reply
  643.         '
  644.         s = News1.BodyText
  645.         Body = News1.From & " wrote:" & vbCrlf
  646.         Do While (s <> "")
  647.             Body = Body & ">" & Left(s, InStr(s, Chr(13)) + 1)
  648.             s = Right(s, Len(s) - (InStr(s, Chr(13)) + 1))
  649.         Loop
  650.         NewMessage.Body.Text = Body
  651.     Else
  652.         '
  653.         ' New message
  654.         '
  655.         NewMessage.NewsGroups.Text = News1.Group
  656.         NewMessage.Subject.Text = ""
  657.         News1.References = ""
  658.     End If
  659.     Flag.Value = 0
  660.     NewMessage.Show 1
  661.     If (Flag.Value = 0) Then
  662.         Exit Sub
  663.     End If
  664.     News1.ArticleID = Format(Now, "ddmmyyhhmmss") & "@" & News1.PostingHost
  665.     News1.Date = Format(Now, "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  666.     News1.Action = NewsPostArticle
  667. End Sub
  668. Sub SetPopupPos (foo As Form)
  669.     foo.Top = Me.Top + Me.Height / 5
  670.     foo.Left = Me.Left + (Me.Width - foo.Width) / 2
  671. End Sub
  672. Sub SettingsConnection_Click ()
  673.     SetPopupPos ConnectionOptionsForm
  674.     ConnectionOptionsForm.Show 1
  675. End Sub
  676. Sub SettingsUser_Click ()
  677.     SetPopupPos UserInfo
  678.     UserInfo.Show 1
  679. End Sub
  680. Sub ShowHeaders_Click ()
  681.     ShowHeaders.Checked = Not ShowHeaders.Checked
  682.     If (ShowHeaders.Checked) Then
  683.         Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  684.     Else
  685.         Text1.Text = News1.BodyText
  686.     End If
  687. End Sub
  688.